package com.ITArmy.service;

import com.ITArmy.beans.Question;
import com.ITArmy.beans.Shows.CommentMessage;
import com.ITArmy.beans.Shows.QuestionShow;
import com.ITArmy.common.ServerResponse;
import com.sun.security.ntlm.Server;
import org.springframework.ui.Model;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

public interface QuestionService {
    /**
     * 遍历所有问题
     *
     * @return ServerResponse
     */
    List<Question> findAllQuestion();

    /**
     *通过问题id查找信息
     * @param id id
     * @return ServerResponse
     */
    QuestionShow findQuestionById(HttpServletRequest request,Long id);


    /**
     * 后台通过问题id查找信息
     * @param id id
     * @return question
     */
    ServerResponse findQuestionByIdByBack(long id);

    /**
     *添加问题
     * @param question question
     * @return ServerResponse
     */
    ServerResponse addQuestion(Question question);

    /**
     * 修改问题信息
     * @param question question
     * @return ServerResponse
     */
    ServerResponse updateQuestion(Question question);

    /**
     * 根据问题标题模糊搜索问题信息
     * @param title title
     * @return ServerResponse
     */
    ServerResponse findQuestionByTitle(String title);

    /**
     * 根据类型查找问题信息
     * @param tid tid
     * @return ServerResponse
     */
    ServerResponse findQuestionByType(Integer tid);

    /**
     *删除问题
     * @param id qid
     * @return ServerResponse
     */
    ServerResponse deleteQuestionById(Long id);

    /**
     * 批量删除
     * @param ids ids
     * @return ServerResponse
     */
    ServerResponse deleteManyByIds(String[] ids);

    /**
     *(前台)发表问题
     * @param request request
     * @param question question
     * @return ServerResponse
     */
    ServerResponse publishQuestion(HttpServletRequest request,Question question);

    /**
     * （前台）采纳回答
     * @param request request
     * @param ruid ruid
     * @param qid qid
     * @return ServerResponse
     */
    ServerResponse adoptComment(HttpServletRequest request,long ruid,long qid,long cid);

    /**
     *(前台)进入主页面
     * @param model model
     */
    void goIndex(Model model);

    /**
     * 获取关于评论的所有消息
     * @param qid qid
     * @return
     */
    List<CommentMessage> getCommentMessage(long qid);
}
